package com.woniuxy.oldmanapi.service;

import com.woniuxy.oldmanapi.entity.Storey;
import com.woniuxy.oldmanapi.mapper.StoreyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StoreyService {

    @Autowired
    StoreyMapper storeyMapper ;

    public List<Storey> findStoreys(int id) {
        List<Storey> StoreyList =  storeyMapper.selectById(id);
        return StoreyList;
    }

    public int add(Storey storey) {
        return storeyMapper.insert(storey);
    }

    public void delete(int id) {
        storeyMapper.deleteByPrimaryKey(id);
    }

    public void modify(Storey storey) {
        storeyMapper.updateByPrimaryKey(storey);
    }

    public Storey selectOne(int id) {
        return storeyMapper.selectByPrimaryKey(id);
    }

    public int findStoreyNum(int id) {
        return storeyMapper.selectNum(id);
    }

    public List<Storey> selectByBuildIdYSW(Integer buildingId) {
        return storeyMapper.selectByBuildIdYSW(buildingId);
    }

    public List<Storey> selectAllList() {
        return storeyMapper.selectAll();
    }
}
